#Cairo canvas. The following variables are available:
# * CNTX: A reference to the current cairo context object
# * W: Canvas width
# * H: Canvas height
# Have fun!

# 

import cairo

color1 = 'Violet'
color2 = 'Orange'

CNTX.select_font_face("Times", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD)
CNTX.set_font_size(50)

line_y = 0
line_x = 0
for i in xrange(len(color2)+1):
    line_y += max( CNTX.text_extents(color1)[3], CNTX.text_extents(color2)[3])
    if len(color2[0:i]) > 0:
        CNTX.set_source_rgb(*COLOR(color2))
        x_bearing, y_bearing, width, height, x_advance, y_advance = CNTX.text_extents(color2[0:i])[:]
        CNTX.move_to( 0, line_y )
        CNTX.show_text(color2[0:i])
        line_x = x_advance
    
    if len(color1[i:]) > 0:
        CNTX.set_source_rgb(*COLOR(color1))
        CNTX.move_to( line_x, line_y )
        CNTX.show_text(color1[i:])
